#ifndef DISPATCHER_H
#define DISPATCHER_H

#include <vector>
#include <tuple>
#include <map>
#include <stdint.h>

#include "analizer.h"

class Analizer;
class Session;

using namespace std;

class Dispatcher {
public:
	Dispatcher();
	~Dispatcher();
	
	void addAnalizer(Analizer*);
	void dispatch(const uint8_t *data, int length);
	
private:
	Analizer *getNextAnalizer();
	void removeSession(Session *s);

	vector<Analizer*> analizers_;
	map<tuple<uint32_t, uint32_t, uint16_t, uint16_t>, Session*> sessions_;
	map<Session*, Analizer*> analTree_;
	int analIndex_;
};

#endif

